<?php

	class Controller_Genres extends Controller_Base
	{
		function index()
		{
			$this->assignData('genres', WebApp::app()->db->select(array('*'),array('genres')));
		}
		function view()
		{
			$id_genre =  WebApp::app()->db->select(array('id'), array('genres'), "`name`='".$this->args[0]."'");
			$id_genre = $id_genre[0]->id;
			$rez = WebApp::app()->db->select(array('games.id', 'games.name', 'games.icon'),array('genres','games','genres_games'),
			"genres.id = ".$id_genre." and genres.id = genres_games.id_genre and genres_games.id_game = games.id");
			$this->assignData('games_cat', $rez);
		}
		
	}

?>